package com.patMall.service.impl;

import com.patMall.entity.UserAddress;
import com.patMall.mapper.UserAddressMapper;
import com.patMall.service.UserAddressService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 750909637@qq.com
 * @PackageName patMall
 * @Package com.patMall.service.impl
 * @Date 2024/1/20 13:23
 * @Version 1.0
 */
@Service
public class UserAddressServiceImpl implements UserAddressService {
    @Resource
    private UserAddressMapper userAddressMapper;
    @Override
    public List<UserAddress> selectAddressByUserId(Integer userId) {
        return userAddressMapper.selectAddressByUserId(userId);
    }

    @Override
    public UserAddress selectById(Integer userId, Integer isDefault) {
        return userAddressMapper.selectById(userId, isDefault);
    }

    @Override
    public int insert(UserAddress row) {
        return userAddressMapper.insert(row);
    }

    @Override
    public int updateAddress(UserAddress userAddress) {
        return userAddressMapper.updateByPrimaryKey(userAddress);
    }
}
